//package com.mical.demo.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.task.TaskExecutor;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//
//import java.util.concurrent.ThreadPoolExecutor;
//
//@Configuration
//public class AsyncTaskConfig {
//
//    @Bean(name = "applicationTaskExecutor")
//    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//        executor.setCorePoolSize(30);
//        executor.setMaxPoolSize(60);
//        executor.setQueueCapacity(0);
//        executor.setThreadNamePrefix("async-exec-");
//        executor.setAllowCoreThreadTimeOut(true);
//        executor.setKeepAliveSeconds(30);
//        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
//        executor.initialize();
//        return executor;
//    }
//}